package com.globalwave.pos.inventory.web;


import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.globalwave.base.BaseAction;
import com.globalwave.pos.inventory.entity.InventoryBalance;
import com.globalwave.pos.inventory.entity.InventoryTransaction;
import com.globalwave.pos.inventory.service.InventoryBalanceBO;
import com.globalwave.system.web.annotations.Pid;
import com.opensymphony.xwork2.Preparable;


@Service("pos_inventoryBalanceAction")
@Scope("prototype")
public class InventoryBalanceAction extends BaseAction implements Preparable {

    private static final long serialVersionUID = 8582051849254108462L;
    
    
    private InventoryBalanceBO inventoryBalanceBO ;
    private InventoryBalance inventoryBalance ;
    private InventoryTransaction inventoryTransaction ;
    

    @Pid(value=1000)
    public String update() throws Exception {
        

    	inventoryBalance = inventoryBalanceBO.update(inventoryTransaction) ;

        renderXML(this.getMessage(inventoryBalance, "").asXML()) ;
        
        
    	return null ;
    }
    
/*
    public String query()  throws Exception {
    	
        renderXML(inventoryBalanceBO.query(inventorySO, pageIndex, pageSize, null).asXML()) ;
        
    	return null ;
    }
    
*/
    public String get()  throws Exception {
    	
    	inventoryBalance =    	
	    	inventoryBalanceBO.getCurrent(
	    			inventoryBalance.getWarehouse_code(), 
	    			inventoryBalance.getStock_item_number()) ;
    	
        renderXML(this.getMessage(inventoryBalance, "").asXML()) ;
        
    	return null ;
    }
    

	@Override
	public void prepare() throws Exception {
		// TODO Auto-generated method stub
		
	}

	public InventoryBalanceBO getInventoryBalanceBO() {
		return inventoryBalanceBO;
	}

	public void setInventoryBalanceBO(InventoryBalanceBO inventoryBalanceBO) {
		this.inventoryBalanceBO = inventoryBalanceBO;
	}

	public InventoryBalance getInventoryBalance() {
		return inventoryBalance;
	}

	public void setInventoryBalance(InventoryBalance inventoryBalance) {
		this.inventoryBalance = inventoryBalance;
	}

	public InventoryTransaction getInventoryTransaction() {
		return inventoryTransaction;
	}

	public void setInventoryTransaction(InventoryTransaction inventoryTransaction) {
		this.inventoryTransaction = inventoryTransaction;
	}
    




    
}
